package copyengine.resource.resProxy.cacheData.create
{
    import copyengine.resource.resProxy.CEResFIleDesc;
    import copyengine.resource.resProxy.cacheData.CECompressedObjResCacheData;
    import copyengine.resource.resProxy.cacheData.CEJsonResCacheData;
    import copyengine.resource.resProxy.cacheData.CEResCacheDataBasic;
    import copyengine.resource.resProxy.cacheData.CESwfResCacheData;
    import copyengine.resource.resProxy.cacheData.CETextureAtlasResCacheData;
    import copyengine.resource.resProxy.cacheData.CETextureResCacheData;
    import copyengine.resource.resProxy.cacheData.CEXMLResCacheData;

    public class CEResCacheDataCreatorBasic implements ICEResCacheDataCreator
    {
        public function CEResCacheDataCreatorBasic()
        {
        }

        public function tryToCreateCEResCacheData(_resFileDesc:CEResFIleDesc):CEResCacheDataBasic
        {
            var cacheData:CEResCacheDataBasic = null;
            switch (_resFileDesc.fileType) {
                case CEResFIleDesc.FILE_TYPE_SWF:
                    cacheData = new CESwfResCacheData();
                    break;
                case CEResFIleDesc.FILE_TYPE_TEXTURE:
                    cacheData = new CETextureResCacheData();
                    break;
                case CEResFIleDesc.FILE_TYPE_ATLAS_TEXTURE:
                    cacheData = new CETextureAtlasResCacheData();
                    break;
                case CEResFIleDesc.FILE_TYPE_COMPRESSED_OBJ:
                    cacheData = new CECompressedObjResCacheData();
                    break;
                case CEResFIleDesc.FILE_TYPE_JSON:
                    cacheData = new CEJsonResCacheData();
                    break;
                case CEResFIleDesc.FILE_TYPE_XML:
                    cacheData = new CEXMLResCacheData();
                    break;
            }
            if (cacheData != null) {
                cacheData.setFileDesc(_resFileDesc);
            }
            return cacheData;
        }
    }
}